FROM openjdk:17-ea-29-slim

ARG URL="https://github.com/iTXTech/mirai-console-loader/releases/download/v2.1.2/mcl-2.1.2.zip"
WORKDIR /mirai
RUN sed -i "s/deb.debian.org/mirrors.tencent.com/g" /etc/apt/sources.list
RUN apt-get clean && apt-get update
RUN apt-get install libpcre2-8-0 libpsl5 publicsuffix wget unzip
RUN wget -O mcl.zip ${URL} && unzip mcl.zip -d mirai && rm mcl.zip && cd mirai && mv ./* .. && cd .. && rm -rf mirai
RUN chmod +x /mirai/mcl
CMD java -jar mcl.jar --update-package net.mamoe:mirai-api-http --channel stable-v2 --type plugin \
    && java -jar mcl.jar
